package com.nhncorp.pleiades.client;

/**
 * Clients register for events with the {@see LockServiceClient}
 * 
 * This interface defines the API for all the events, but clients need not
 * register for all the event types. In this case, only a stub method is
 * required to implement this interface.
 *
 */

public interface LockEventHandler {
  /** Called when contents of node are modified */
  public void contentsModified(LockEventData eventData);
  /** Called when a new child node is added */
  public void nodeAdded(LockEventData eventData);
  /** Called when a child node is removed */
  public void nodeRemoved(LockEventData eventData);
  /** Called when a child node is modified */
  public void nodeModified(LockEventData eventData);
  /** Called when the master lock server fails over */
  public void masterFailover();
  
  /** Called when the session is in jeopardy of timing out 
   * this event is processed from local client 
   */
  public void sessionWarning();
  /**
   * Called if the session was in jeopardy but was able to communicate with
   * the lock server before the session timed out.
   * this event is processed from local client
   */
  public void sessionSafe();
  /**
   * Called if the session was in jeopardy and was not able to communicate with
   * the lock server before the session timed out.
   * this event is processed from local client
   */
  public void sessionExpired();
  /**
   * Called if the session timed out. this event is processed from event manager
   */
  public void clientExpired(LockEventData eventData);  
  /**
   * Called if the node is expired due to session expiration
   */
  public void lockExpired(LockEventData eventData);
  /**
   * Add a customized monitor to listen to the interesting events
   */
  public void addLockEventMonitor(LockEventMonitor monitor);
  /**
   * Remove an event monitor
   */
  public void removeEventMonitor(LockEventMonitor monitor);
  public void clearLockEventMonitors();
}
